<#import "html-macro.ftl" as h />
<#import "declaration-macro.ftl" as d/>
<#--<form class="ui large goodsForm">-->
<div class="dashedbar text-blue"><span>商品信息</span></div>
<div class="ui grid goodsForm" id="commodities">
    <div class="row">
        <input type="hidden" id="id"/>
    <@h.label  width="2" value="商品序号" required=true />
    <@h.input width="3" id="index_num" readonly=true />
    <#if d.declarationType__>
        <@h.label width="2" value="手册备案序号"/>
        <@h.input width="4" id="record_id" readonly=d.isGeneralTrade__/>
    <#else>
        <@h.label width="2" value="合同商品项目序号"/>
        <@h.input width="4" id="contractNumber" readonly=d.isGeneralTrade__/>
    </#if>
    <@h.label width="2" value="商品编号"  required=true/>
    <@h.dropdown width="3" id="code_t" />
        <input type="hidden" id="code_s"/>
    <@h.label width="2" value="商品名称"  required=true />
    <@h.input width="3" id="name"/>
    <#if d.declarationType__>
        <@h.label width="2" value="规格型号"/>
        <@h.input width="4" id="key_elements"  />
    <#else>
        <@h.label width="2" value="规格型号"/>
    <#--<@h.input width="6" id="key_elements"  />-->
        <@h.input width="4" id="goods_mode"  />
    </#if>
    <#if d.declarationType__>
        <#if d.isGeneralTrade__>
            <@h.label width="2" value="要素"  required=true/>
            <@h.input width="3" id="goods_mode"  />
        <#else>
            <@h.label width="2" value="要素"/>
            <@h.input width="3" id="goods_mode" readonly=true />
        </#if>
    </#if>
    <#if !d.declarationType__>
        <@h.label  width="2" value="征免"  required=true />
        <@h.dropdown width="3" id="levyModeCode" showId="levymode"/>
    </#if>
    <@h.label width="2" value="计价数量"  required=true />
    <@h.input width="3" id="count" dataType="float" />
    <@h.label width="2" value="计价单位"  required=true />
    <@h.dropdown width="4" id="unitCode" showId="unit"  />
    <@h.label width="2" value="总价"  required=true />
    <@h.input width="3" id="total_price" dataType="float" />
    <@h.label  width="2" value="法定数量"  required=true />
    <@h.input width="3" id="legal_count" dataType="float" />
    <@h.label width="2" value="法定单位"  required=true />
    <#if d.declarationType__>
        <@h.dropdown width="4" id="legalUnitCode" showId="legal_unit" readonly=true/>
    <#else>
        <@h.dropdown width="4" id="legalUnitCode" showId="legal_unit"/>
    </#if>
    <@h.label width="2" value="单价"  required=true />
    <@h.input width="3" id="unit_price" dataType="float" readonly=true />
    <@h.label width="2" value="第二数量"  />
    <@h.input width="3" id="second_count" dataType="float" />
    <@h.label width="2" value="第二计量单位" />
    <#if d.declarationType__>
        <@h.dropdown width="4" id="secondUnitCode" showId="second_unit" readonly=true/>
    <#else>
        <@h.dropdown width="4" id="secondUnitCode" showId="second_unit"/>
    </#if>
    <@h.label  width="2" value="币制"  required=true />
    <@h.dropdown width="3" id="currencyCode" showId="currency" />

    <#if d.declarationType__>
        <@h.label width="2" value="目的国"  required=true />
        <@h.dropdown width="3" id="destination_code" showId="destination"/>
        <@h.label  width="2" value="原产国"  required=true />
        <@h.dropdown width="4" id="origin_country_code" showId="origin_country" />
    <#else>
        <@h.label width="2" value="原产国"  required=true />
        <@h.dropdown width="3" id="origin_country_code" showId="origin_country" />
        <@h.label width="2" value="目的国"  required=true />
        <@h.dropdown width="4" id="destination_code" showId="destination"/>
    </#if>
    <#if d.declarationType__>
        <@h.label  width="2" value="征免"  required=true />
        <@h.dropdown width="3" id="levyModeCode" showId="levymode"/>
    </#if>

    <#if d.declarationType__><#--出口-->
        <@h.label width="2" value="包装种类" required=true  />
        <@h.input width="3" id="package_type" />
        <@h.label width="2" value="包装件数"  required=true />
        <@h.input width="4" id="goods_number" dataType="float" />
        <@h.label width="2" value="毛重(KG)"  required=true />
        <@h.input width="3" id="goods_gross_weight" dataType="float" />
        <@h.label width="2" value="净重(KG)" required=true  />
        <@h.input width="3" id="goods_net_weight" dataType="float" />
        <@h.label width="2" value="版本号" />
        <@h.input width="4" id="version_no" readonly=d.isGeneralTrade__/>
        <#if d.isGeneralTrade__><#--一般贸易-->
            <@h.label width="2" value="货号" />
            <@h.input width="3" id="goods_no" readonly=true/>
        <#else>
            <@h.label width="2" value="货号" />
            <@h.input width="3" id="goods_no" />
        <#--<@h.label width="2" value="工缴费"  required=true />
        <@h.input width="3" id="processing_fee" dataType="float" />-->
        </#if>



        <@h.label width="2" value="工缴费"/>
        <@h.input width="3" id="processing_fee" dataType="float" />
        <@h.label width="2" value="装箱单备注内容" />
        <@h.input width=d.isGeneralTrade__?string("4","3") id="packinglist_remark" />
    <#--<#else>
        <#if !d.isGeneralTrade__>
            <@h.label value="工缴费"  required=true />
            <@h.input width="2" id="processing_fee" dataType="float" />
        </#if>-->
    </#if>
    </div>
</div>
<div class="ui error message"></div>
<#--只读模式不显示-->
<#if !h.readMode__>
<div class="row ui grid button-line">
    <div class="sixteen wide column right floated">
        <button id="goodsAdd" class="mini ui labeled icon button blue right floated">
            <i class="plus icon"></i>
            添加
        </button>
        <button id="goodsSave"
                class="mini ui labeled icon button  blue right floated saveGoodsSubmit">
            <i class="save icon"></i>
            保存商品
        </button>
        <button id="goodsCancle"
                class="mini ui labeled icon button  blue right floated ">
            <i class="remove icon"></i>
            取消
        </button>
    </div>
</div>
</#if>
<#--</form>-->
<table class="ui celled table center aligned"
       <#if h.readMode__>id="goodsListTable"</#if>
       style="font-size: 12px;">
    <thead>
    <th>序号</th>
    <#if d.isProcessTrade__>
        <#if !d.declarationType__>
        <th>合同商品项目序号</th>
        <#else>
        <th>手册备案序号</th>
        </#if>
    </#if>
    <th>商品编号</th>
    <th>商品名称</th>
    <th>计价数量</th>
    <th>计价单位</th>
    <#if !d.declarationType__>
    <th>总价/币制</th>
    <#else>
    <th>装箱单备注内容</th>
    </#if>
    <#--只读模式不显示-->
    <#if !h.readMode__>
    <th>操作</th>
    </#if>
    </thead>
    <tbody>
    <#list declaration.commodities as cmmo>
    <tr>
        <input name="commodities[${cmmo_index}].id" type="hidden"
               value="${cmmo.id}">
        <input name="commodities[${cmmo_index}].index_num" type="hidden"
               value="${cmmo.index_num}">
        <input name="commodities[${cmmo_index}].contractNumber" type="hidden"
               value="${cmmo.contractNumber}">
        <input name="commodities[${cmmo_index}].code_s" type="hidden"
               value="${cmmo.code_s}">
        <input name="commodities[${cmmo_index}].code_t" type="hidden"
               value="${cmmo.code_t}">
        <input name="commodities[${cmmo_index}].name" type="hidden"
               value="${cmmo.name}">
        <input name="commodities[${cmmo_index}].key_elements" type="hidden"
               value="${cmmo.key_elements}">
        <input name="commodities[${cmmo_index}].goods_mode" type="hidden"
               value="${cmmo.goods_mode}">
        <input name="commodities[${cmmo_index}].count" type="hidden"
               value="${cmmo.count}">
        <input name="commodities[${cmmo_index}].unitCode" type="hidden"
               value="${cmmo.unitCode}">
        <input name="commodities[${cmmo_index}].unit" type="hidden"
               value="${cmmo.unit}">
        <input name="commodities[${cmmo_index}].total_price" type="hidden"
               value="${cmmo.total_price}">
        <input name="commodities[${cmmo_index}].unit_price" type="hidden"
               value="${cmmo.unit_price}">
        <input name="commodities[${cmmo_index}].currencyCode" type="hidden"
               value="${cmmo.currencyCode}">
        <input name="commodities[${cmmo_index}].currency" type="hidden"
               value="${cmmo.currency}">
        <input name="commodities[${cmmo_index}].legal_count" type="hidden"
               value="${cmmo.legal_count}">
        <input name="commodities[${cmmo_index}].legalUnitCode" type="hidden"
               value="${cmmo.legalUnitCode}">
        <input name="commodities[${cmmo_index}].legal_unit" type="hidden"
               value="${cmmo.legal_unit}">
        <input name="commodities[${cmmo_index}].destination" type="hidden"
               value="${cmmo.destination}">
        <input name="commodities[${cmmo_index}].destination_code" type="hidden"
               value="${cmmo.destination_code}">
        <input name="commodities[${cmmo_index}].origin_country" type="hidden"
               value="${cmmo.origin_country}">
        <input name="commodities[${cmmo_index}].origin_country_code" type="hidden"
               value="${cmmo.origin_country_code}">
        <input name="commodities[${cmmo_index}].levyModeCode" type="hidden"
               value="${cmmo.levyModeCode}">
        <input name="commodities[${cmmo_index}].levymode" type="hidden"
               value="${cmmo.levymode}">
        <input name="commodities[${cmmo_index}].second_count" type="hidden"
               value="${cmmo.second_count}">
        <input name="commodities[${cmmo_index}].secondUnitCode" type="hidden"
               value="${cmmo.secondUnitCode}">
        <input name="commodities[${cmmo_index}].second_unit" type="hidden"
               value="${cmmo.second_unit}">
        <input name="commodities[${cmmo_index}].version_no" type="hidden"
               value="${cmmo.version_no}">
        <input name="commodities[${cmmo_index}].goods_no" type="hidden"
               value="${cmmo.goods_no}">
        <input name="commodities[${cmmo_index}].processing_fee" type="hidden"
               value="${cmmo.processing_fee}">
        <input name="commodities[${cmmo_index}].package_type" type="hidden"
               value="${cmmo.package_type}">
        <input name="commodities[${cmmo_index}].goods_gross_weight" type="hidden"
               value="${cmmo.goods_gross_weight}">
        <input name="commodities[${cmmo_index}].goods_net_weight" type="hidden"
               value="${cmmo.goods_net_weight}">
    <#--<input name="commodities[${cmmo_index}].boxMark" type="hidden"
           value="${cmmo.boxMark}">-->
        <input name="commodities[${cmmo_index}].goods_number" type="hidden"
               value="${cmmo.goods_number}">
        <input name="commodities[${cmmo_index}].packinglist_remark" type="hidden"
               value="${cmmo.packinglist_remark}">
        <td>${cmmo.index_num}</td>
        <#if d.isProcessTrade__>
            <td>
                <#if !d.declarationType__>
                    ${cmmo.contractNumber}
                    <#else>
                ${cmmo.record_id}
                </#if>
            </td>
        </#if>
        <td>${cmmo.code_t}</td>
        <td>${cmmo.name}</td>
        <td>${cmmo.count}</td>
        <td>${cmmo.unit}</td>
        <#if !d.declarationType__>
            <td>${cmmo.total_price}${cmmo.currency}</td>
        <#else>
            <td>${cmmo.packinglist_remark}</td>
        </#if>
    <#--<td>${cmmo.packinglist_remark}</td>-->

    <#--只读模式不显示-->
        <#if !h.readMode__>
            <td>
                <button class="ui mini primary basic button">修改</button>
                <button class="ui mini negative basic button">删除</button>
                <button class="ui mini purple basic button">复制</button>
                <button class="ui mini black basic button"><i class="arrow up icon"></i>
                </button>
                <button class="ui mini brown basic button"><i class="arrow down icon"></i>
                </button>
            </td>
        </#if>
    </tr>
    </#list>
    </tbody>
    <tfoot>
    <tr>
        <th colspan="8">
        <#if d.declarationType__>
            <div class="ui basic label">件数总汇:
                <div class="detail">
                    件
                </div>
            </div>
            <div class="ui basic label">毛重总汇:
                <div class="detail">
                    千克
                </div>
            </div>
            <div class="ui basic label">净重总汇:
                <div class="detail total-net-weight">
                    千克
                </div>
            </div>
        </#if>
            <div class="ui basic label">总价总汇:
                <div class="detail">
                    币制
                </div>
            </div>
        </th>
    </tr>
    </tfoot>
</table>